
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace Camelio.DAL
{
	public abstract class _Products : SqlClientEntity
	{
		public _Products()
		{
			this.QuerySource = "Products";
			this.MappingName = "Products";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ProdID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ProdID, ProdID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ProdID
			{
				get
				{
					return new SqlParameter("@ProdID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CatID
			{
				get
				{
					return new SqlParameter("@CatID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter ProdName
			{
				get
				{
					return new SqlParameter("@ProdName", SqlDbType.NVarChar, 250);
				}
			}
			
			public static SqlParameter ProdType
			{
				get
				{
					return new SqlParameter("@ProdType", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter ProdIsSoiree
			{
				get
				{
					return new SqlParameter("@ProdIsSoiree", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter ProdColor
			{
				get
				{
					return new SqlParameter("@ProdColor", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter ProdSize
			{
				get
				{
					return new SqlParameter("@ProdSize", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter ProdQuantity
			{
				get
				{
					return new SqlParameter("@ProdQuantity", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter ProdNetPrice
			{
				get
				{
					return new SqlParameter("@ProdNetPrice", SqlDbType.Float, 0);
				}
			}
			
			public static SqlParameter ProdPrice
			{
				get
				{
					return new SqlParameter("@ProdPrice", SqlDbType.Float, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ProdID = "ProdID";
            public const string CatID = "CatID";
            public const string ProdName = "ProdName";
            public const string ProdType = "ProdType";
            public const string ProdIsSoiree = "ProdIsSoiree";
            public const string ProdColor = "ProdColor";
            public const string ProdSize = "ProdSize";
            public const string ProdQuantity = "ProdQuantity";
            public const string ProdNetPrice = "ProdNetPrice";
            public const string ProdPrice = "ProdPrice";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ProdID] = _Products.PropertyNames.ProdID;
					ht[CatID] = _Products.PropertyNames.CatID;
					ht[ProdName] = _Products.PropertyNames.ProdName;
					ht[ProdType] = _Products.PropertyNames.ProdType;
					ht[ProdIsSoiree] = _Products.PropertyNames.ProdIsSoiree;
					ht[ProdColor] = _Products.PropertyNames.ProdColor;
					ht[ProdSize] = _Products.PropertyNames.ProdSize;
					ht[ProdQuantity] = _Products.PropertyNames.ProdQuantity;
					ht[ProdNetPrice] = _Products.PropertyNames.ProdNetPrice;
					ht[ProdPrice] = _Products.PropertyNames.ProdPrice;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ProdID = "ProdID";
            public const string CatID = "CatID";
            public const string ProdName = "ProdName";
            public const string ProdType = "ProdType";
            public const string ProdIsSoiree = "ProdIsSoiree";
            public const string ProdColor = "ProdColor";
            public const string ProdSize = "ProdSize";
            public const string ProdQuantity = "ProdQuantity";
            public const string ProdNetPrice = "ProdNetPrice";
            public const string ProdPrice = "ProdPrice";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ProdID] = _Products.ColumnNames.ProdID;
					ht[CatID] = _Products.ColumnNames.CatID;
					ht[ProdName] = _Products.ColumnNames.ProdName;
					ht[ProdType] = _Products.ColumnNames.ProdType;
					ht[ProdIsSoiree] = _Products.ColumnNames.ProdIsSoiree;
					ht[ProdColor] = _Products.ColumnNames.ProdColor;
					ht[ProdSize] = _Products.ColumnNames.ProdSize;
					ht[ProdQuantity] = _Products.ColumnNames.ProdQuantity;
					ht[ProdNetPrice] = _Products.ColumnNames.ProdNetPrice;
					ht[ProdPrice] = _Products.ColumnNames.ProdPrice;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ProdID = "s_ProdID";
            public const string CatID = "s_CatID";
            public const string ProdName = "s_ProdName";
            public const string ProdType = "s_ProdType";
            public const string ProdIsSoiree = "s_ProdIsSoiree";
            public const string ProdColor = "s_ProdColor";
            public const string ProdSize = "s_ProdSize";
            public const string ProdQuantity = "s_ProdQuantity";
            public const string ProdNetPrice = "s_ProdNetPrice";
            public const string ProdPrice = "s_ProdPrice";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ProdID
	    {
			get
	        {
				return base.Getint(ColumnNames.ProdID);
			}
			set
	        {
				base.Setint(ColumnNames.ProdID, value);
			}
		}

		public virtual int CatID
	    {
			get
	        {
				return base.Getint(ColumnNames.CatID);
			}
			set
	        {
				base.Setint(ColumnNames.CatID, value);
			}
		}

		public virtual string ProdName
	    {
			get
	        {
				return base.Getstring(ColumnNames.ProdName);
			}
			set
	        {
				base.Setstring(ColumnNames.ProdName, value);
			}
		}

		public virtual string ProdType
	    {
			get
	        {
				return base.Getstring(ColumnNames.ProdType);
			}
			set
	        {
				base.Setstring(ColumnNames.ProdType, value);
			}
		}

		public virtual bool ProdIsSoiree
	    {
			get
	        {
				return base.Getbool(ColumnNames.ProdIsSoiree);
			}
			set
	        {
				base.Setbool(ColumnNames.ProdIsSoiree, value);
			}
		}

		public virtual string ProdColor
	    {
			get
	        {
				return base.Getstring(ColumnNames.ProdColor);
			}
			set
	        {
				base.Setstring(ColumnNames.ProdColor, value);
			}
		}

		public virtual string ProdSize
	    {
			get
	        {
				return base.Getstring(ColumnNames.ProdSize);
			}
			set
	        {
				base.Setstring(ColumnNames.ProdSize, value);
			}
		}

		public virtual int ProdQuantity
	    {
			get
	        {
				return base.Getint(ColumnNames.ProdQuantity);
			}
			set
	        {
				base.Setint(ColumnNames.ProdQuantity, value);
			}
		}

		public virtual double ProdNetPrice
	    {
			get
	        {
				return base.Getdouble(ColumnNames.ProdNetPrice);
			}
			set
	        {
				base.Setdouble(ColumnNames.ProdNetPrice, value);
			}
		}

		public virtual double ProdPrice
	    {
			get
	        {
				return base.Getdouble(ColumnNames.ProdPrice);
			}
			set
	        {
				base.Setdouble(ColumnNames.ProdPrice, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ProdID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdID) ? string.Empty : base.GetintAsString(ColumnNames.ProdID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdID);
				else
					this.ProdID = base.SetintAsString(ColumnNames.ProdID, value);
			}
		}

		public virtual string s_CatID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CatID) ? string.Empty : base.GetintAsString(ColumnNames.CatID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CatID);
				else
					this.CatID = base.SetintAsString(ColumnNames.CatID, value);
			}
		}

		public virtual string s_ProdName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdName) ? string.Empty : base.GetstringAsString(ColumnNames.ProdName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdName);
				else
					this.ProdName = base.SetstringAsString(ColumnNames.ProdName, value);
			}
		}

		public virtual string s_ProdType
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdType) ? string.Empty : base.GetstringAsString(ColumnNames.ProdType);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdType);
				else
					this.ProdType = base.SetstringAsString(ColumnNames.ProdType, value);
			}
		}

		public virtual string s_ProdIsSoiree
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdIsSoiree) ? string.Empty : base.GetboolAsString(ColumnNames.ProdIsSoiree);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdIsSoiree);
				else
					this.ProdIsSoiree = base.SetboolAsString(ColumnNames.ProdIsSoiree, value);
			}
		}

		public virtual string s_ProdColor
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdColor) ? string.Empty : base.GetstringAsString(ColumnNames.ProdColor);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdColor);
				else
					this.ProdColor = base.SetstringAsString(ColumnNames.ProdColor, value);
			}
		}

		public virtual string s_ProdSize
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdSize) ? string.Empty : base.GetstringAsString(ColumnNames.ProdSize);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdSize);
				else
					this.ProdSize = base.SetstringAsString(ColumnNames.ProdSize, value);
			}
		}

		public virtual string s_ProdQuantity
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdQuantity) ? string.Empty : base.GetintAsString(ColumnNames.ProdQuantity);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdQuantity);
				else
					this.ProdQuantity = base.SetintAsString(ColumnNames.ProdQuantity, value);
			}
		}

		public virtual string s_ProdNetPrice
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdNetPrice) ? string.Empty : base.GetdoubleAsString(ColumnNames.ProdNetPrice);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdNetPrice);
				else
					this.ProdNetPrice = base.SetdoubleAsString(ColumnNames.ProdNetPrice, value);
			}
		}

		public virtual string s_ProdPrice
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProdPrice) ? string.Empty : base.GetdoubleAsString(ColumnNames.ProdPrice);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProdPrice);
				else
					this.ProdPrice = base.SetdoubleAsString(ColumnNames.ProdPrice, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ProdID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdID, Parameters.ProdID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CatID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CatID, Parameters.CatID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdName, Parameters.ProdName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdType
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdType, Parameters.ProdType);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdIsSoiree
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdIsSoiree, Parameters.ProdIsSoiree);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdColor
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdColor, Parameters.ProdColor);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdSize
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdSize, Parameters.ProdSize);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdQuantity
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdQuantity, Parameters.ProdQuantity);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdNetPrice
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdNetPrice, Parameters.ProdNetPrice);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProdPrice
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProdPrice, Parameters.ProdPrice);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ProdID
		    {
				get
		        {
					if(_ProdID_W == null)
	        	    {
						_ProdID_W = TearOff.ProdID;
					}
					return _ProdID_W;
				}
			}

			public WhereParameter CatID
		    {
				get
		        {
					if(_CatID_W == null)
	        	    {
						_CatID_W = TearOff.CatID;
					}
					return _CatID_W;
				}
			}

			public WhereParameter ProdName
		    {
				get
		        {
					if(_ProdName_W == null)
	        	    {
						_ProdName_W = TearOff.ProdName;
					}
					return _ProdName_W;
				}
			}

			public WhereParameter ProdType
		    {
				get
		        {
					if(_ProdType_W == null)
	        	    {
						_ProdType_W = TearOff.ProdType;
					}
					return _ProdType_W;
				}
			}

			public WhereParameter ProdIsSoiree
		    {
				get
		        {
					if(_ProdIsSoiree_W == null)
	        	    {
						_ProdIsSoiree_W = TearOff.ProdIsSoiree;
					}
					return _ProdIsSoiree_W;
				}
			}

			public WhereParameter ProdColor
		    {
				get
		        {
					if(_ProdColor_W == null)
	        	    {
						_ProdColor_W = TearOff.ProdColor;
					}
					return _ProdColor_W;
				}
			}

			public WhereParameter ProdSize
		    {
				get
		        {
					if(_ProdSize_W == null)
	        	    {
						_ProdSize_W = TearOff.ProdSize;
					}
					return _ProdSize_W;
				}
			}

			public WhereParameter ProdQuantity
		    {
				get
		        {
					if(_ProdQuantity_W == null)
	        	    {
						_ProdQuantity_W = TearOff.ProdQuantity;
					}
					return _ProdQuantity_W;
				}
			}

			public WhereParameter ProdNetPrice
		    {
				get
		        {
					if(_ProdNetPrice_W == null)
	        	    {
						_ProdNetPrice_W = TearOff.ProdNetPrice;
					}
					return _ProdNetPrice_W;
				}
			}

			public WhereParameter ProdPrice
		    {
				get
		        {
					if(_ProdPrice_W == null)
	        	    {
						_ProdPrice_W = TearOff.ProdPrice;
					}
					return _ProdPrice_W;
				}
			}

			private WhereParameter _ProdID_W = null;
			private WhereParameter _CatID_W = null;
			private WhereParameter _ProdName_W = null;
			private WhereParameter _ProdType_W = null;
			private WhereParameter _ProdIsSoiree_W = null;
			private WhereParameter _ProdColor_W = null;
			private WhereParameter _ProdSize_W = null;
			private WhereParameter _ProdQuantity_W = null;
			private WhereParameter _ProdNetPrice_W = null;
			private WhereParameter _ProdPrice_W = null;

			public void WhereClauseReset()
			{
				_ProdID_W = null;
				_CatID_W = null;
				_ProdName_W = null;
				_ProdType_W = null;
				_ProdIsSoiree_W = null;
				_ProdColor_W = null;
				_ProdSize_W = null;
				_ProdQuantity_W = null;
				_ProdNetPrice_W = null;
				_ProdPrice_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ProdID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdID, Parameters.ProdID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CatID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CatID, Parameters.CatID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdName, Parameters.ProdName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdType
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdType, Parameters.ProdType);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdIsSoiree
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdIsSoiree, Parameters.ProdIsSoiree);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdColor
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdColor, Parameters.ProdColor);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdSize
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdSize, Parameters.ProdSize);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdQuantity
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdQuantity, Parameters.ProdQuantity);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdNetPrice
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdNetPrice, Parameters.ProdNetPrice);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProdPrice
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProdPrice, Parameters.ProdPrice);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ProdID
		    {
				get
		        {
					if(_ProdID_W == null)
	        	    {
						_ProdID_W = TearOff.ProdID;
					}
					return _ProdID_W;
				}
			}

			public AggregateParameter CatID
		    {
				get
		        {
					if(_CatID_W == null)
	        	    {
						_CatID_W = TearOff.CatID;
					}
					return _CatID_W;
				}
			}

			public AggregateParameter ProdName
		    {
				get
		        {
					if(_ProdName_W == null)
	        	    {
						_ProdName_W = TearOff.ProdName;
					}
					return _ProdName_W;
				}
			}

			public AggregateParameter ProdType
		    {
				get
		        {
					if(_ProdType_W == null)
	        	    {
						_ProdType_W = TearOff.ProdType;
					}
					return _ProdType_W;
				}
			}

			public AggregateParameter ProdIsSoiree
		    {
				get
		        {
					if(_ProdIsSoiree_W == null)
	        	    {
						_ProdIsSoiree_W = TearOff.ProdIsSoiree;
					}
					return _ProdIsSoiree_W;
				}
			}

			public AggregateParameter ProdColor
		    {
				get
		        {
					if(_ProdColor_W == null)
	        	    {
						_ProdColor_W = TearOff.ProdColor;
					}
					return _ProdColor_W;
				}
			}

			public AggregateParameter ProdSize
		    {
				get
		        {
					if(_ProdSize_W == null)
	        	    {
						_ProdSize_W = TearOff.ProdSize;
					}
					return _ProdSize_W;
				}
			}

			public AggregateParameter ProdQuantity
		    {
				get
		        {
					if(_ProdQuantity_W == null)
	        	    {
						_ProdQuantity_W = TearOff.ProdQuantity;
					}
					return _ProdQuantity_W;
				}
			}

			public AggregateParameter ProdNetPrice
		    {
				get
		        {
					if(_ProdNetPrice_W == null)
	        	    {
						_ProdNetPrice_W = TearOff.ProdNetPrice;
					}
					return _ProdNetPrice_W;
				}
			}

			public AggregateParameter ProdPrice
		    {
				get
		        {
					if(_ProdPrice_W == null)
	        	    {
						_ProdPrice_W = TearOff.ProdPrice;
					}
					return _ProdPrice_W;
				}
			}

			private AggregateParameter _ProdID_W = null;
			private AggregateParameter _CatID_W = null;
			private AggregateParameter _ProdName_W = null;
			private AggregateParameter _ProdType_W = null;
			private AggregateParameter _ProdIsSoiree_W = null;
			private AggregateParameter _ProdColor_W = null;
			private AggregateParameter _ProdSize_W = null;
			private AggregateParameter _ProdQuantity_W = null;
			private AggregateParameter _ProdNetPrice_W = null;
			private AggregateParameter _ProdPrice_W = null;

			public void AggregateClauseReset()
			{
				_ProdID_W = null;
				_CatID_W = null;
				_ProdName_W = null;
				_ProdType_W = null;
				_ProdIsSoiree_W = null;
				_ProdColor_W = null;
				_ProdSize_W = null;
				_ProdQuantity_W = null;
				_ProdNetPrice_W = null;
				_ProdPrice_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductsInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductsDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ProdID);
			p.SourceColumn = ColumnNames.ProdID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ProdID);
			p.SourceColumn = ColumnNames.ProdID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CatID);
			p.SourceColumn = ColumnNames.CatID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdName);
			p.SourceColumn = ColumnNames.ProdName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdType);
			p.SourceColumn = ColumnNames.ProdType;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdIsSoiree);
			p.SourceColumn = ColumnNames.ProdIsSoiree;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdColor);
			p.SourceColumn = ColumnNames.ProdColor;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdSize);
			p.SourceColumn = ColumnNames.ProdSize;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdQuantity);
			p.SourceColumn = ColumnNames.ProdQuantity;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdNetPrice);
			p.SourceColumn = ColumnNames.ProdNetPrice;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProdPrice);
			p.SourceColumn = ColumnNames.ProdPrice;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
